package cn.kailangtu.dataspot.data.context;

import android.graphics.Color;
import android.widget.TextView;
import cn.kailangtu.dataspot.R;

public class KeyboardConfirmContext {
    public static String tipMsg;
    private  static TextView selectedView;
    private static int normalColor;
    public static TextView getSelectedView()
    {
        return selectedView;
    }

    public  static void setSelectedView(TextView newView)
    {

        if(selectedView != null)
        {

            if(selectedView.getTag().equals("cancel")){
                selectedView.setBackgroundResource(R.drawable.button_confirm_normal);
            }
            else if(selectedView.getTag().equals("save")){
                selectedView.setBackgroundResource(R.drawable.button_confirm_normal);
            }
            selectedView.setTextColor(normalColor);
        }
        normalColor = newView.getCurrentTextColor();
        selectedView = newView;
        newView.setTextColor(Color.parseColor("#1d73fa"));

        if(selectedView.getTag().equals("cancel")){
            selectedView.setBackgroundResource(R.drawable.button_confirm_selected);
            //selectedView.setTextColor(Color.parseColor("#FFFFFF"));
        }
        else if(selectedView.getTag().equals("save")){
            selectedView.setBackgroundResource(R.drawable.button_confirm_selected);
            //selectedView.setTextColor(Color.parseColor("#FFFFFF"));
        }
    }

    public static void entry(){
        if(selectedView != null){
            selectedView.callOnClick();
        }

    }
}
